package com.zyl.po;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import lombok.Data;

import java.util.List;

@Data
public class Employee {
    private String code;

    private String name;

    private String postion;

    private String superiorCode;

    public static List<Employee> getAll() {
        JSONArray objects = JSONUtil.parseArray(IoUtil.read(Thread.currentThread().getContextClassLoader().getResourceAsStream("json1.txt"), "utf-8"));
        List<Employee> employees = JSONUtil.toList(objects, Employee.class);
        return employees;
    }
}
